<?php
/*Author: maoge
*2011-7-10
*/
class Rhome extends CI_Model {
	function __construct(){
		parent::__construct();
	}
	
	function get_categories(){
		$query = $this->db->get('categories');
		return $query->result();
	}
	function get_books_list($category_id){
		$query = $this->db->get_where('book',array('book_cid'=>$category_id));
		return $query->result();
	}
	function get_categores_name($category_id){
		$query = $this->db->get_where('categories',array('category_id'=>$category_id));
		return $query->result();
	}
	function get_book_content($book_id){
		$query = $this->db->get_where('book',array('book_id'=>$book_id));
		return $query->result();
	}
	function insert_comment($data){
		$this->db->set('comment_date', 'NOW()',FALSE);
		$query = $this->db->insert('comments',$data);
		return $query;
	}
	function get_comment($comment_book_id){
		$query = $this->db->get_where('comments',array('comment_book_id' => $comment_book_id));
		return $query->result();
	}
}
?>